package com.ruoyi.web.controller.bank;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TAppRecentTransactions;
import com.ruoyi.system.service.ITAppRecentTransactionsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 最近交易Controller
 * 
 * @author ruoyi
 * @date 2025-04-23
 */
@RestController
@RequestMapping("/system/transactions")
public class TAppRecentTransactionsController extends BaseController
{
    @Autowired
    private ITAppRecentTransactionsService tAppRecentTransactionsService;

    /**
     * 查询最近交易列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TAppRecentTransactions tAppRecentTransactions)
    {
        startPage();
        List<TAppRecentTransactions> list = tAppRecentTransactionsService.selectTAppRecentTransactionsList(tAppRecentTransactions);
        return getDataTable(list);
    }

    /**
     * 导出最近交易列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, TAppRecentTransactions tAppRecentTransactions)
    {
        List<TAppRecentTransactions> list = tAppRecentTransactionsService.selectTAppRecentTransactionsList(tAppRecentTransactions);
        ExcelUtil<TAppRecentTransactions> util = new ExcelUtil<TAppRecentTransactions>(TAppRecentTransactions.class);
        util.exportExcel(response, list, "最近交易数据");
    }

    /**
     * 获取最近交易详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tAppRecentTransactionsService.selectTAppRecentTransactionsById(id));
    }

    /**
     * 新增最近交易
     */
    @PostMapping
    public AjaxResult add(@RequestBody TAppRecentTransactions tAppRecentTransactions)
    {
        return toAjax(tAppRecentTransactionsService.insertTAppRecentTransactions(tAppRecentTransactions));
    }

    /**
     * 修改最近交易
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TAppRecentTransactions tAppRecentTransactions)
    {
        return toAjax(tAppRecentTransactionsService.updateTAppRecentTransactions(tAppRecentTransactions));
    }

    /**
     * 删除最近交易
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tAppRecentTransactionsService.deleteTAppRecentTransactionsByIds(ids));
    }
}
